<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function myClass() {
            var students = []
            var operations = {
                joinStu: function(name) {
                    students.push(name)
                },
                leaveStu: function(name) {
                    for(var i=0; i<students.length; i++) {
                        var item = students[i]
                        if(item === name) {
                            students.splice(i, 1)
                        }
                    }
                },
                findStu: function() {
                    console.log(students)
                }
            }
            return operations
        }
        var class1 = myClass()

        class1.findStu()            // []
        class1.joinStu('Trist')     
        class1.findStu()            // ["Trist"]
        class1.joinStu('张三')   
        class1.findStu()            // ["Trist", "张三"]
        class1.leaveStu("张三")
        class1.findStu()            // ["Trist"]   
    </script>
</body>
</html>